<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body id="all">
    <p>姓名：<input type="text" id="name"></p>
    <p id="age1">年龄：<input type="text" id="age"></p>
    <p>电话：<input type="text" id="tel"></p>
    <p>住址：<input type="text" id="adrr"></p>
    <button onclick="alert1()">确定</button>
    <script>
        var All = document.getElementById("all");
        var age1 = document.getElementById("age1");
        var p = document.createElement("p");
        var sex = document.createTextNode("性别：");
        var ip = document.createElement("input");
        ip.setAttribute("type", "text");
        ip.setAttribute("id", "sex");
        p.appendChild(sex);
        p.appendChild(ip);
        All.insertBefore(p, age1);
        function alert1() {
            var name = document.getElementById("name").value;
            var age = document.getElementById("age").value;
            var tel = document.getElementById("tel").value;
            var adrr = document.getElementById("adrr").value;
            var sex = document.getElementById("sex").value;
            alert("姓名：" + name + "年龄：" + age + "ta的电话是" + tel + "地址是：" + adrr);
        }
        var adrr = document.getElementById("adrr");
        adrr.style.width = "200px";
        adrr.style.height = "100px";
        adrr.style.border = "2px solid red";

    </script>

</body>

</html>